#include "fact_with_mask_searcher.hpp"

#include "utils.hpp"

namespace mashine { namespace kb { namespace search {

FactWithMaskSearchVisitor::FactWithMaskSearchVisitor(mashine::kb::Literal Literal) 
		: SearchVisitor<mashine::kb::Literal *, mashine::kb::Literal>(Literal)
{
}

std::vector<mashine::kb::Literal *> FactWithMaskSearchVisitor::search(mashine::kb::KnowledgeBase * kBase)
{
	std::vector<mashine::kb::Literal *> result;
	
	std::vector<mashine::kb::Literal>::const_iterator i = kBase->getFacts().begin();
	for (; i != kBase->getFacts().end(); ++i)
		if ( !criteria.getName().compare((*i).getName()))
			if (criteria == *i)
				result.push_back(const_cast<mashine::kb::Literal *>(&(*i)));
				
	return result;
}

}}}